<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <mate name="viewport" content="width=device-width, initial-scale=1.0"></mate>
    <title>后台登录</title>
    <script src="../../static/js/jquery.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.5.0/dist/semantic.min.js"></script>
    <link href="https://cdn.jsdelivr.net/npm/semantic-ui@2.5.0/dist/semantic.min.css" rel="stylesheet">
    <link rel="stylesheet" href="../../static/css/me.css">

</head>
<body>
    <div class="m-container-small m-padded-tb-massive" style="max-width: 30em !important;">
    <div class="ur container">
        <div class="ui middle aligned center aligned grid">
            <div class="column">
                <h2 class="ui teal image header">
                    <div class="content">
                        广软社区信息系统
                    </div>
                </h2>
                <form class="ui large form" id="loginTable" method="post" action="#" th:action="@{/admin/login}">
                    <div class="ui segment">
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="user icon"></i>
                                <input type="text" name="username" placeholder="用户名">
                            </div>
                        </div>
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="lock icon"></i>
                                <input type="password" name="password" placeholder="密码">
                            </div>
                        </div>
                        <button class="ui fluid large teal submit button">登   录</button>
                        <a href="/register/toRegister" style="margin-top: 7px;" class="ui fluid large blue button">快速注册</a>
                    </div>

                    <div class="ui error message"></div>
                    <div class="ui mini negative message" th:unless="${#strings.isEmpty(message)}" th:text="${message}" >用户名和密码错误</div>

                </form>

            </div>
        </div>
    </div>
</div>

<script>
    $("#loginTable").form({
       fields:{
           username:{
               identifier:"username",
               rules:[{
                   type:'empty',
                   prompt:'用户名不能为空'
               }]
           },
           password:{
               identifier:"password",
               rules:[{
                   type:'empty',
                   prompt:'密码不能为空'
               }]
           }
       }
    });
</script>
</body>
</html>